function tot= negtotaldonationsadd(rho, lambda1, lambda2, lambda3, a)

def=rho+a;
n=length(rho);
z=zeros(n,1);
nozero= (rho~=0);
nz=sum(nozero);
% create indicator for who indures cost
z(nozero)=[rand(1,nz)>lambda1];
nd=sum(z);
z=(z==1);

% draw deltas
delta=zeros(n,1);
mu=1/lambda2;
delta(z) = exprnd(mu, [nd, 1]); 

% draw alpha
mu3=1/lambda3;
alpha = exprnd(mu3, [n, 1]);

% utility for different choices
Vx= (rho.^2)/2;
Ux= Vx- delta;
U0= -alpha;
Udef= rho.* def- (def.^2)./2;

sim_donation=zeros(n,1);

sim_donation(~z)=rho(~z);
switchtorho=zeros(n,1);
switchtorho(z)= (Ux(z)>=U0(z) & Ux(z)>Udef(z));
stay_default=zeros(n,1);
stay_default(z)= (Udef(z)>=Ux(z) & Udef(z)>= U0(z));
optout=zeros(n,1);
optout(z)=(U0(z)>Ux(z) & U0(z)>Udef(z));

sim_donation(switchtorho==1)=rho(switchtorho==1);
sim_donation(stay_default==1)=def(stay_default==1);
sim_donation(optout==1)=0;

tot=-sum(sim_donation);
